package exam.uit;


import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;

public class DanhSach{

	public static final String KEY_ROWID = "sohieu";
	public static final String KEY_NAME = "tentuyen";
	public static final String KEY_DI = "luotdi";
	public static final String KEY_VE = "luotve";
	private static final String DATABASE_PATH = "/data/data/exam.uit/database/hcm.sqlite";
	private static final String DATABASE_NAME = "hcm.sqlite";
	private static final String DATABASE_TABLE = "data";
	private static final int DATABASE_VERSION = 1;

	private DbHelper ourHelper;
	private final Context ourContext;
	private SQLiteDatabase ourDatabase;
	
	DanhSach(Context c){
		ourContext = c;
	}
	



	public void openDatabase(){
		this.ourDatabase = SQLiteDatabase.openDatabase(DATABASE_PATH, null, 0);
	}
	
	public String getInfo(String ms){
		String result = "";
		String[] columns = new String[]{};
		Cursor c = ourDatabase.query(DATABASE_TABLE, columns, KEY_ROWID + "=" + ms, null, null, null, null);
		int iRow = c.getColumnIndex(KEY_ROWID);
		int iName = c.getColumnIndex(KEY_NAME);
		if(c != null)
		{
			c.moveToFirst();
			result = result + c.getString(iRow) + "\n Tên Tuyến : " + c.getString(iName);
			return result;
					
		}
		
		return null;
	}
	
	
	public void close(){
		this.ourDatabase.close();
	}
}
	

	

